import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "dbshopST012_搜索商品"
# 1.选择商品名称，输入“美的”，点击“搜索”按钮。
firefox = openBrowser(urlAdmin)
# 登录后台
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox, '商品管理', '管理商品')
firefox.find_element_by_xpath("//input[@name='goods_name']").send_keys("美的")
firefox.find_element_by_xpath('//button').click()
time.sleep(10)
# 2.搜索成功美的的后台商品
s = firefox.find_element_by_xpath('//tbody/tr[2]/td[3]').text
print(s)
# 断言
try:
    if "美的" in s:
        writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()
